#include "cpu/exec/helper.h"

make_helper(call_rel_v) {
    int32_t rel32 = instr_fetch(eip + 1, 4);
    uint32_t next_eip = eip + 5;

    cpu.esp -= 4;
    swaddr_write(cpu.esp, 4, next_eip);

    eip += rel32;
    print_asm("call 0x%x", next_eip);
    return 5;
}

make_helper(call_rm_v) {
    int len = decode_rm_l(eip + 1);
    uint32_t next_eip = eip + len + 1;

    cpu.esp -= 4;
    swaddr_write(cpu.esp, 4, next_eip);

    eip = op_src->val;
    print_asm("call *%s", op_src->str);
    return len + 1;
}
